import request from '@/utils/network/request';
import serviceUri from '@/utils/configUrl';

const { apiUrl } = serviceUri;

/**
 * 文件流式返回
 * @param { String } url 接口地址
 * @param { Object } params 接口参数
 * @param { String } method 请求方式
 * @returns
 */
export const fileBlobFun = (url, params, method = 'GET') => {
  return request({
    url: `${apiUrl}/${url}`,
    method: method,
    params: params,
    responseType: 'blob'
  });
};

// 上传附件
export function uploadFile(data) {
  let token = '';
  return request({
    url: '/fapi/httt-file/filetransfer/uploadfile',
    method: 'post',
    headers: {
      'Authorization': `Basic ${encodeURIComponent('test-sso-1:test-sso-1-key')}`,
      'Blade-Auth': 'bearer ' + token,
      'token': token,
      'Tenant-Id': '000000'
    },
    data: data
  });
}
